package com.hzlj.position.locate.common.enums;

import com.fz.common.base.exception.PubError;
import com.fz.common.base.exception.PubException;
import lombok.Getter;

/**
 * @author fanzhuo
 */

@Getter
public enum AreaOutType {
    NONE("0", "未外出"),
    PROVINCE("1", "出省"),
    CITY("2", "出市"),
    DISTRICT("3", "出区"),
    ;

    private String code;
    private String text;

    AreaOutType(String code, String text) {
        this.code = code;
        this.text = text;
    }

    public static AreaOutType of(String value) {
        for (AreaOutType checkTypeEnum : values()) {
            if (checkTypeEnum.getCode().equals(value)) {
                return checkTypeEnum;
            }
        }
        throw new PubException(PubError.PARAM_EMPTY_ERROR);
    }
}
